/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sqlgenerators.search;

import entities.Search;
import entities.SearchRelocatingInfoRequerimentOrOperator;

/**
 *
 * @author damfercer
 */
public class RelocatingOrResitrictionsSQLGenerator implements SearchSqlGeneratorInterface{
    private String res;
    @Override
    public String getSqlFromSearch(Search search) {
        res="";
//        res+=" AND(";
//        if(search.getSearchRelocatingInfoRequerimentOrOperatorList().isEmpty()){
//            res+="TRUE";
//        }
//        else{
//            res+="(FALSE";
//        }
//        if(!search.getSearchRelocatingInfoRequerimentOrOperatorList().isEmpty()){
//            res+=")";
//        }
//        if(!search.getSearchRelocatingInfoRequerimentOrOperatorList().isEmpty()){
//            for(SearchRelocatingInfoRequerimentOrOperator restriction: search.getSearchRelocatingInfoRequerimentOrOperatorList()){
//                res+=" OR(FALSE OR (TRUE";
//                res+=generateSearchRelocatingInfoRequerimentOrOperatorSQL(restriction);
//                res+="))";
//            }
//        }
//        res+=")";
        return res;
    }
    
    private String generateSearchRelocatingInfoRequerimentOrOperatorSQL(SearchRelocatingInfoRequerimentOrOperator restr){
        String result="";
//        if(restr.getCountry()!=null){
//            result+=" AND candidate_relocating_info.COUNTRY="+restr.getCountry().getIdCountry();
//            if(restr.getProvince()!=null){
//                result+=" AND (candidate_relocating_info.PROVINCE IS NULL OR candidate_relocating_info.PROVINCE="+restr.getProvince().getIdProvince()+")";
//            }
//            else{
//                result+=" AND candidate_relocating_info.PROVINCE IS NULL";
//            }
//        }
//        
        return result;
    }
}
